import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Welcome from './views/Welcome.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "login" */ './views/Login.vue')
    },
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: { name: 'welcome' }, // 将页面重定向到欢迎页面
      children: [
        {
          path: '/users', // 欢迎页面是home页面的子路由
          name: 'users',
          component: () => import(/* webpackChunkName: "about" */ './views/users/user.vue')
        },
        {
          path: '/roles', // 欢迎页面是home页面的子路由
          name: 'roles',
          component: () => import(/* webpackChunkName: "about" */ './views/right/roles.vue')
        },
        {
          path: '/rights', // 欢迎页面是home页面的子路由
          name: 'rights',
          component: () => import(/* webpackChunkName: "about" */ './views/right/rights.vue')
        },
        {
          path: '/welcome',
          name: 'welcome',
          component: Welcome
        },
        {
          path: '/goods',
          name: 'goods',
          component: () => import(/* webpackChunkName: "goods" */ './views/goods/Goods.vue')
        },
        {
          path: '/categories',
          name: 'categories',
          component: () => import(/* webpackChunkName: "categories" */ './views/goods/Categories.vue')
        }

      ]
    }
  ]
})
